<?php
namespace Model\Factory;


use Model\AddressTable;
use Model\AlbumTable;
use Model\ArticleTable;
use Model\BlockClassTable;
use Model\BlockInstanceTable;
use Model\CategoryTable;
use Model\CountryTable;
use Model\DishArticleTable;
use Model\DishCategoryTable;
use Model\DishImageTable;
use Model\DishLangTable;
use Model\DishPriceTable;
use Model\DishTable;
use Model\DishTagTable;
use Model\DistrictTable;
use Model\DomainConfig;
use Model\DomainConfigTable;
use Model\DomainPageTable;
use Model\DomainTemplateGroupTable;
use Model\DomainTemplateTable;
use Model\DomainUserTable;
use Model\MenuItemTable;
use Model\MenuTable;
use Model\PageTable;
use Model\PrivilegeTable;
use Model\PrivilegeTypeTable;
use Model\ProvinceTable;
use Model\RestaurantOwnerTable;
use Model\RestaurantTable;
use Model\RoleTable;
use Model\RouteTable;
use Model\TemplateTable;
use Model\UnitLangTable;
use Model\UnitTable;
use Model\UserBalanceTable;
use Model\UserRoleTable;
use Model\UserTable;
use Model\TagTable;
use Model\ArticleCategoryTable;
use Model\ArticleTagTable;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class TableFinder implements ServiceLocatorAwareInterface{

   private $serviceLocator;

    /**
     * Set service locator
     *
     * @param ServiceLocatorInterface $serviceLocator
     */
    public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
    {
        $this->serviceLocator = $serviceLocator;
    }

    /**
     * Get service locator
     *
     * @return ServiceLocatorInterface
     */
    public function getServiceLocator()
    {
        return $this->serviceLocator;
    }

    /**
     * @var UserTable
     */
    protected $userTable;

    public function getUserTable()
    {
        if (!$this->userTable) {
            $sm = $this->getServiceLocator();
            $this->userTable = $sm->get('Model\UserTable');
        }
        return $this->userTable;
    }

    /**
     * @var CountryTable
     */
    protected $countryTable;

    public function getCountryTable()
    {
        if (!$this->countryTable) {
            $sm = $this->getServiceLocator();
            $this->countryTable = $sm->get('Model\CountryTable');
        }
        return $this->countryTable;
    }

    /**
     * @var AlbumTable
     */
    protected $albumTable;

    public function getAlbumTable()
    {
        if (!$this->albumTable) {
            $sm = $this->getServiceLocator();
            $this->albumTable = $sm->get('Model\AlbumTable');
        }
        return $this->albumTable;
    }

    /**
     * @var TemplateTable
     */
    protected $templateTable;

    public function getTemplateTable($lang)
    {
        if (!$this->templateTable) {
            $sm = $this->getServiceLocator();
            $this->templateTable = $sm->get('Model\TemplateTable');
            $this->templateTable->setLang($lang);
        }
        return $this->templateTable;
    }


    /**
     * @var BlockClassTable
     */
    protected $blockClassTable;

    /**
     * @return BlockClassTable
     */
    public function getBlockClassTable()
    {
        if (!$this->blockClassTable) {
            $sm = $this->getServiceLocator();
            $this->blockClassTable = $sm->get('Model\BlockClassTable');
        }
        return $this->blockClassTable;
    }

    /**
     * @var BlockInstanceTable
     */
    protected $blockInstanceTable;

    public function getBlockInstanceTable()
    {
        if (!$this->blockInstanceTable) {
            $sm = $this->getServiceLocator();
            $this->blockInstanceTable = $sm->get('Model\BlockInstanceTable');

        }
        return $this->blockInstanceTable;
    }

    /**
     * @var RoleTable
     */
    protected $roleTable;

    public function getRoleTable()
    {
        if (!$this->roleTable) {
            $sm = $this->getServiceLocator();
            $this->roleTable = $sm->get('Model\RoleTable');
        }
        return $this->roleTable;
    }

    /**
     * @var PrivilegeTable
     */
    protected $privilegeTable;

    public function getPrivilegeTable()
    {
        if (!$this->privilegeTable) {
            $sm = $this->getServiceLocator();
            $this->privilegeTable = $sm->get('Model\PrivilegeTable');
        }
        return $this->privilegeTable;
    }

    /**
     * @var PrivilegeTypeTable
     */
    protected $privilegeTypeTable;

    public function getPrivilegeTypeTable()
    {
        if (!$this->privilegeTypeTable) {
            $sm = $this->getServiceLocator();
            $this->privilegeTable = $sm->get('Model\PrivilegeTypeTable');
        }
        return $this->privilegeTable;
    }

    /**
     * @var PageTable
     */
    protected $pageTable;

    public function getPageTable()
    {
        if (!$this->pageTable) {
            $sm = $this->getServiceLocator();
            $this->pageTable = $sm->get('Model\PageTable');
        }
        return $this->pageTable;
    }

    /**
     * @var RouteTable
     */
    protected $routeTable;

    public function getRouteTable($lang)
    {
        if (!$this->routeTable) {
            $sm = $this->getServiceLocator();
            $this->routeTable = $sm->get('Model\RouteTable');
            $this->routeTable->setLang($lang);
        }
        return $this->routeTable;
    }

    /**
     * @var MenuTable
     */
    protected $menuTable;

    public function getMenuTable($lang)
    {
        if (!$this->menuTable) {
            $sm = $this->getServiceLocator();
            $this->menuTable = $sm->get('Model\MenuTable');
            $this->menuTable->setLang($lang);
        }
        return $this->menuTable;
    }

    /**
     * @var MenuItemTable
     */
    protected $menuItemTable;

    public function getMenuItemTable()
    {
        if (!$this->menuItemTable) {
            $sm = $this->getServiceLocator();
            $this->menuItemTable = $sm->get('Model\MenuItemTable');
        }
        return $this->menuItemTable;
    }

    /**
     * @var ArticleTable
     */
    protected $articleTable;

    public function getArticleTable()
    {
        if (!$this->articleTable) {
            $sm = $this->getServiceLocator();
            $this->articleTable = $sm->get('Model\ArticleTable');
        }
        return $this->articleTable;
    }

    /**
     * @var TagTable
     */
    protected $tagTable;

    public function getTagTable($lang)
    {
        if (!$this->tagTable) {
            $sm = $this->getServiceLocator();
            $this->tagTable = $sm->get('Model\TagTable');
            $this->tagTable->setLang($lang);
        }
        return $this->tagTable;
    }

    /**
     * @var ArticleCategoryTable
     */
    protected $articleCategoryTable;

    public function getArticleCategoryTable()
    {
        if (!$this->articleCategoryTable) {
            $sm = $this->getServiceLocator();
            $this->articleCategoryTable = $sm->get('Model\ArticleCategoryTable');
        }
        return $this->articleCategoryTable;
    }

    /**
     * @var ArticleTagTable
     */
    protected $articleTagTable;

    public function getArticleTagTable()
    {
        if (!$this->articleTagTable) {
            $sm = $this->getServiceLocator();
            $this->articleTagTable = $sm->get('Model\ArticleTagTable');
        }
        return $this->articleTagTable;
    }


    /**
     * @var CategoryTable
     */
    protected $categoryTable;

    public function getCategoryTable($lang)
    {
        if (!$this->categoryTable) {
            $sm = $this->getServiceLocator();
            $this->categoryTable = $sm->get('Model\CategoryTable');
            $this->categoryTable->setLang($lang);
        }
        return $this->categoryTable;
    }

    /**
     * @var DishTable
     */
    protected $dishTable;

    public function getDishTable($lang)
    {
        if (!$this->dishTable) {
            $sm = $this->getServiceLocator();
            $this->dishTable = $sm->get('Model\DishTable');
            $this->dishTable->setLang($lang);
        }
        return $this->dishTable;
    }

    /**
     * @var DishLangTable
     */
    protected $dishLangTable;

    public function getDishLangTable($lang)
    {
        if (!$this->dishLangTable) {
            $sm = $this->getServiceLocator();
            $this->dishLangTable = $sm->get('Model\DishLangTable');
            $this->dishLangTable->setLang($lang);
        }
        return $this->dishLangTable;
    }

    /**
     * @var DishCategoryTable
     */
    protected $dishCategoryTable;

    public function getDishCategoryTable()
    {
        if (!$this->dishCategoryTable) {
            $sm = $this->getServiceLocator();
            $this->dishCategoryTable = $sm->get('Model\DishCategoryTable');

        }
        return $this->dishCategoryTable;
    }

    /**
     * @var UnitTable
     */
    protected $unitTable;

    public function getUnitTable($lang)
    {
        if (!$this->unitTable) {
            $sm = $this->getServiceLocator();
            $this->unitTable = $sm->get('Model\UnitTable');
            $this->unitTable->setLang($lang);
        }
        return $this->unitTable;
    }

    /**
     * @var UnitLangTable
     */
    protected $unitLangTable;

    public function getUnitLangTable()
    {
        if (!$this->unitLangTable) {
            $sm = $this->getServiceLocator();
            $this->unitLangTable = $sm->get('Model\UnitLangTable');
        }
        return $this->unitLangTable;
    }

    /**
     * @var DishTagTable
     */
    protected $dishTagTable;

    public function getDishTagTable($lang)
    {
        if (!$this->dishTagTable) {
            $sm = $this->getServiceLocator();
            $this->dishTagTable = $sm->get('Model\DishTagTable');
            $this->dishTagTable->setLang($lang);
        }
        return $this->dishTagTable;
    }

    /**
     * @var DishPriceTable
     */
    protected $dishPriceTable;

    public function getDishPriceTable()
    {
        if (!$this->dishPriceTable) {
            $sm = $this->getServiceLocator();
            $this->dishPriceTable = $sm->get('Model\DishPriceTable');
        }
        return $this->dishPriceTable;
    }


    /**
     * @var DishArticleTable
     */
    protected $dishArticleTable;

    public function getDishArticleTable($lang)
    {
        if (!$this->dishArticleTable) {
            $sm = $this->getServiceLocator();
            $this->dishArticleTable = $sm->get('Model\DishArticleTable');
            $this->dishArticleTable->setLang($lang);
        }
        return $this->dishArticleTable;

    }

    /**
     * @var DishImageTable
     */
    protected $dishImageTable;

    public function getDishImageTable()
    {
        if (!$this->dishImageTable) {
            $sm = $this->getServiceLocator();
            $this->dishImageTable = $sm->get('Model\DishImageTable');
        }
        return $this->dishImageTable;

    }

    /**
     * @var AddressTable
     */
    protected $addressTable;

    public function getAddressTable()
    {
        if (!$this->addressTable) {
            $sm = $this->getServiceLocator();
            $this->addressTable = $sm->get('Model\AddressTable');
        }
        return $this->addressTable;

    }

    /**
     * @var ProvinceTable
     */
    protected $provinceTable;

    public function getProvinceTable()
    {
        if (!$this->provinceTable) {
            $sm = $this->getServiceLocator();
            $this->provinceTable = $sm->get('Model\ProvinceTable');
        }
        return $this->provinceTable;

    }


    /**
     * @var DistrictTable
     */
    protected $districtTable;

    public function getDistrictTable()
    {
        if (!$this->districtTable) {
            $sm = $this->getServiceLocator();
            $this->districtTable = $sm->get('Model\DistrictTable');
        }
        return $this->districtTable;

    }

    /**
     * @var RestaurantTable
     */
    protected $restaurantTable;

    public function getRestaurantTable()
    {
        if (!$this->restaurantTable) {
            $sm = $this->getServiceLocator();
            $this->restaurantTable = $sm->get('Model\RestaurantTable');
        }
        return $this->restaurantTable;

    }

    /**
     * @var RestaurantOwnerTable
     */
    protected $restaurantOwnerTable;

    public function getRestaurantOwnerTable()
    {
        if (!$this->restaurantOwnerTable) {
            $sm = $this->getServiceLocator();
            $this->restaurantOwnerTable = $sm->get('Model\RestaurantOwnerTable');
        }
        return $this->restaurantOwnerTable;

    }

    /**
     * @var DomainConfigTable
     */
    protected $domainConfigTable;

    public function getDomainConfigTable()
    {
        if (!$this->domainConfigTable) {
            $sm = $this->getServiceLocator();
            $this->domainConfigTable = $sm->get('Model\DomainConfigTable');
        }
        return $this->domainConfigTable;

    }

    /**
     * @var DomainTemplateGroupTable
     */
    protected $domainTemplateGroupTable;

    public function getDomainTemplateGroupTable()
    {
        if (!$this->domainTemplateGroupTable) {
            $sm = $this->getServiceLocator();
            $this->domainTemplateGroupTable = $sm->get('Model\DomainTemplateGroupTable');
        }
        return $this->domainTemplateGroupTable;

    }

    /**
     * @var DomainTemplateTable
     */
    protected $domainTemplateTable;

    public function getDomainTemplateTable()
    {
        if (!$this->domainTemplateTable) {
            $sm = $this->getServiceLocator();
            $this->domainTemplateTable = $sm->get('Model\DomainTemplateTable');
        }
        return $this->domainTemplateTable;

    }

    /**
     * @var DomainPageTable
     */
    protected $domainPageTable;

    public function getDomainPageTable()
    {
        if (!$this->domainPageTable) {
            $sm = $this->getServiceLocator();
            $this->domainPageTable = $sm->get('Model\DomainPageTable');
        }
        return $this->domainPageTable;

    }

    /**
     * @var DomainUserTable
     */
    protected $domainUserTable;

    public function getDomainUserTable()
    {
        if (!$this->domainUserTable) {
            $sm = $this->getServiceLocator();
            $this->domainUserTable = $sm->get('Model\DomainUserTable');
        }
        return $this->domainUserTable;

    }

    /**
     * @var UserBalanceTable
     */
    protected $userBalanceTable;

    public function getUserBalanceTable()
    {
        if (!$this->userBalanceTable) {
            $sm = $this->getServiceLocator();
            $this->userBalanceTable = $sm->get('Model\UserBalanceTable');
        }
        return $this->userBalanceTable;

    }

    /**
     * @var UserRoleTable
     */
    protected $userRoleTable;

    public function getUserRoleTable()
    {
        if (!$this->userRoleTable) {
            $sm = $this->getServiceLocator();
            $this->userRoleTable = $sm->get('Model\UserRoleTable');
        }
        return $this->userRoleTable;

    }

}